﻿<%@ Control Language="C#" AutoEventWireup="true" Codebehind="UserPermision.ascx.cs"
    Inherits="Portal.Administrator.Users.UserPermision" %>
<%@ Register Assembly="System.Web.Extensions" Namespace="System.Web.UI" TagPrefix="asp" %>
<table border="0" cellpadding="2" cellspacing="2" class="InputBox" style="width: 100%">
    <tr>
        <td style="width: 11%">
            <asp:Label ID="lblUser" runat="server" Text="Người dùng" meta:resourcekey="lblUserResource1" Font-Bold="True"></asp:Label></td>
        <td colspan="2">
            <asp:Label ID="lblUsername" runat="server" Font-Bold="True" Width="69px" meta:resourcekey="lblUsernameResource1"></asp:Label></td>
    </tr>
    <tr>
        <td>
            <asp:Label ID="lblPortal" runat="server" Text="Portal" meta:resourcekey="lblPortalResource1" Font-Bold="True"></asp:Label></td>
        <td colspan="2">
            <asp:DropDownList ID="dropPortal" runat="server" DataTextField="Portal_Name" DataValueField="PortalID"
                AutoPostBack="True" meta:resourcekey="dropPortalResource1" OnSelectedIndexChanged="dropPortal_SelectedIndexChanged">
            </asp:DropDownList></td>
    </tr>
    <tr>
        <td style="width: 11%" valign="top">
        </td>
        <td valign="top" style="width: 89%">
            <table width="100%" cellpadding="0" cellspacing="0">
                <tr>
                    <td valign="top" style="width: 50%; height: 621px;">
                        <asp:UpdatePanel ID="upanelUserPermission" runat="server" UpdateMode="Conditional"
                            RenderMode="Inline">
                            <Triggers>
                                <asp:AsyncPostBackTrigger controlid="btnUpdate" eventname="Click" />
                                <asp:AsyncPostBackTrigger controlid="dropPortal" eventname="SelectedIndexChanged" />
                            </Triggers>
                            <ContentTemplate>
                                <asp:ListBox ID="lstCommands" runat="server" Height="621px" SelectionMode="Multiple"
                                    Width="300px" meta:resourcekey="lstCommandsResource1"></asp:ListBox>
                                    <br />
                        <asp:Button ID="btnUpdate" runat="server" CssClass="Button" OnClick="btnUpdate_Click"
                            Text="Cập nhật" meta:resourcekey="btnUpdateResource1" />
                        <asp:Label ID="lblUpdateStatus" runat="server" ForeColor="Blue"></asp:Label>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                        <br />
                    </td>
                    <td valign="top" style="width: 50%; height: 621px;">
                        <asp:UpdatePanel ID="upanelUserPermission1" runat="server" UpdateMode="Conditional"
                            RenderMode="Inline">
                            <Triggers>
                                <asp:AsyncPostBackTrigger ControlID="btnUpdate" EventName="Click" />
                                <asp:AsyncPostBackTrigger ControlID="btnUpdateAll" EventName="Click" />
                                <asp:AsyncPostBackTrigger ControlID="dropPortal" EventName="SelectedIndexChanged" />
                            </Triggers>
                            <ContentTemplate>
                                <asp:GridView ID="dgrUserRole" runat="server" AutoGenerateColumns="False" Width="100%"
                                    OnRowCommand ="dgrUserRole_ItemCommand" OnRowDataBound="dgrUserRole_ItemDataBound"
                                    OnRowEditing="dgrUserRole_RowEditing"
                                    CellPadding="0" meta:resourcekey="dgrUserRoleResource1" AllowPaging="true" PageSize="50" OnPageIndexChanging="dgrUserRole_PageIndexChanging">
                                    <RowStyle HorizontalAlign="Center" />
                                    <HeaderStyle BackColor="Desktop" HorizontalAlign="Center" ForeColor="White" />
                                    <Columns>                                        
                                        <asp:BoundField DataField="UserID" Visible="True" />
                                        <asp:BoundField DataField="CommandID" Visible="True" />
                                        <asp:BoundField DataField="PortalID" Visible="True" />
                                        <asp:TemplateField>
                                            <ItemStyle HorizontalAlign="Left" />
                                            <HeaderStyle Width="50%" HorizontalAlign="Left" />
                                            <ItemTemplate>
                                                <asp:Label ID="lblCmdName" runat="server" meta:resourcekey="lblCmdNameResource1"></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Đọc">
                                            <ItemStyle HorizontalAlign="Center" />
                                            <HeaderStyle Width="10%" HorizontalAlign="Center" />
                                            <ItemTemplate>
                                                <asp:CheckBox ID="chkView" runat="server" meta:resourcekey="chkViewResource1" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Ghi">
                                            <ItemStyle HorizontalAlign="Center" />
                                            <HeaderStyle Width="10%" HorizontalAlign="Center" />
                                            <ItemTemplate>
                                                <asp:CheckBox ID="chkAdd" runat="server" meta:resourcekey="chkAddResource1" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Sửa">
                                            <ItemStyle HorizontalAlign="Center" />
                                            <HeaderStyle Width="10%" HorizontalAlign="Center" />
                                            <ItemTemplate>
                                                <asp:CheckBox ID="chkEdit" runat="server" meta:resourcekey="chkEditResource1" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="X&#243;a">
                                            <ItemStyle HorizontalAlign="Center" />
                                            <HeaderStyle Width="10%" HorizontalAlign="Center" />
                                            <ItemTemplate>
                                                <asp:CheckBox ID="chkDelete" runat="server" meta:resourcekey="chkDeleteResource1" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <ItemStyle HorizontalAlign="Center" />
                                            <HeaderStyle Width="10%" HorizontalAlign="Center" />
                                            <ItemTemplate>
                                                <asp:Button runat="server" CssClass="solidButton" ID="btnUpdate" Text="Update" CommandName="edit"
                                                    meta:resourcekey="btnUpdateResource2" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                </asp:GridView><br/>
                                <asp:Button ID="btnUpdateAll" CssClass="Button" runat="server" Text="Cập nhật tất cả"
                            OnClick="btnUpdateAll_Click" meta:resourcekey="btnUpdateAllResource1" OnClientClick="javascript:return confirm('Bạn đã chắc chắn chưa' )" />
                        <asp:Label ID="lblUpdateStatus1" runat="server" ForeColor="Blue"></asp:Label></td>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                </tr>
            </table>
        </td>
    </tr>
</table>
